home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 May: Tool Chest / Developer CD Series May 1996 (Tool Chest) (Apple Computer) (1996).iso / Tool Chest / Files / UnmountIt 1.2 / ServerControlIntf.p < prev    next >
Encoding:
Text File  |  1995-06-20  |  9.3 KB  |  289 lines  |  [TEXT/MPS ]

  1. {
  2. Created: Monday, April 27, 1992 at 2:50 PM
  3.     ServerControlIntf.p
  4.     Pascal Interface to the Macintosh Libraries
  5.  
  6.         Copyright Apple Computer, Inc. 1990-1992
  7.         All rights reserved
  8. }
  9.  
  10. UNIT ServerControlIntf;
  11.  
  12. INTERFACE
  13.  
  14.     USES
  15.         AppleTalk;
  16.  
  17.     CONST
  18.         ServerDispatch = $A094;    { The server control dispatch trap. }
  19.  
  20.         { scCode values }
  21.         SCStartServer                = 0;
  22.         SCShutDown                    = 2;
  23.         SCCancelShutDown            = 3;
  24.         SCDisconnect                = 4;
  25.         SCPollServer                = 5;
  26.         SCGetExpFldr                = 6;
  27.         SCGetSetupInfo                = 7;
  28.         SCSetSetupInfo                = 8;
  29.         SCSendMessage                = 9;
  30.         SCGetServerStatus            = 10;
  31.         SCInstallServerEventProc    = 11;
  32.         SCRemoveServerEventProc        = 12;
  33.         SCGetServerEventProc        = 13;
  34.         SCServerVersion                = 14;
  35.         SCSetCopyProtect            = 16;
  36.         SCClrCopyProtect            = 17;
  37.         SCDisconnectVolUsers        = 18;
  38.         SCGetUserNameRec            = 19;
  39.         SCGetUserMountInfo            = 20;
  40.         SCWakeServer                = 21;
  41.         SCSleepServer                = 22;
  42.         { all other values of scCode are reserved }
  43.  
  44.         { scFlags bits and masks for disconnectPB }
  45.         bUNRFSendMsg                = 13;        { send a message }
  46.         UNRFSendMsgMask                = $2000;    { send a message }
  47.  
  48.         { These are error codes that are returned from an SCDisconnect trap }
  49.         AlreadyShuttingDown            = -1;        { the server is already shutting down }
  50.         AlreadyDisconnecting        = -2;        { the server is already disconnecting }
  51.  
  52.         { scServerType contains the server type, which is interpreted as follows: }
  53.         MFSType                        = $0000;    { Macintosh File Sharing }
  54.         AFSType                        = $0001;    { AppleShare File Server }
  55.  
  56.         { scServerVersion is the server version, which is currently interpreted as follows: }
  57.         {    $0030 : File Sharing Extension, versions 7.0 and 7.0.1 }
  58.         {    $0031 : File Server Extension, version 3.0 }
  59.         {    $0032 : File Sharing Extension, version 7.0.2 }
  60.  
  61.         { These are some random constants for SCStartServer }
  62.         kCurInstalled                = 0;        { the currently installed server }
  63.         kFinderExtn                    = 0;        { send high level events to the finder extension }
  64.  
  65.         { scServerFlags bits returned by SCGetServerStatus }
  66.         bJBSEnabled                 = 12;        { Set if Apple II boot service is enabled }
  67.  
  68.         { These "SCPS" integers are passed back from a SCPollServer call in scServerState: }
  69.         { 0 means: 0 <= seconds left < 30 and Network Setup says : "Less than a minute"}
  70.         { 1 means: 30 <= seconds left < 90 and Network Setup says : "About a minute"}
  71.         { 2 thru 4094: x*60-30 <= seconds left < x*60+30 and NS says: "About X minutes" }
  72.         SCPSRunning                    = -1;        { Server running normally }
  73.         SCPSStartingUp                = -2;        { Server is in the process of starting up }
  74.         SCPSJustDisabled            = -3;        { Server is just disabled and there was no startup error }
  75.         SCPSDisabledwErr            = -4;        { Server is disabled and there is an "SE" error in scServerError }
  76.         SCPSSleeping                = -5;        { Server is temporarily disabled }
  77.  
  78.         { These "SCPD" integers are passed back from a SCPollServer call in scDisconnectState: }
  79.         { 0 means: 0 <= seconds left < 30 and FileShare Monitor says : "Less than a minute"}
  80.         { 1 means: 30 <= seconds left < 90 and FileShare Monitor says : "About a minute"}
  81.         { 2 thru 4094: x*60-30 <= seconds left < x*60+30 and FM says: "About X minutes" }
  82.         SCPDNotDisconnecting        = -1;        { Server not disconnecting some one or some group of users }
  83.  
  84.  
  85.         { These are Server Errors ("SE") error codes returned in scServerError by }
  86.         { a SCPollServer call }
  87.         SENoUGFileOpenErr            = 1;         { "The Users & Groups file could not be opened." }
  88.         SENoRealVolsErr                = 2;        { "There are no volumes for AppleShare to use." }
  89.         SEInsuffMFMemErr            = 4;        { "There was not enough memory available to start AppleShare File Service." }
  90.         SECantRegNameErr            = 5;        { "The File Server's name could not be registered on the AppleTalk Network." }
  91.         SECantFindExtnFolder        = 6;        { "The File Server could not be started because the Extensions folder could not be found" }
  92.         SEUnExATalkErr                = 7;        { "An unexpected AppleTalk error occurred." }
  93.         SENoMachineName                = 8;        { "You must have a machine name." }
  94.         SECantFindFSExtn            = 9;        { "The File Server could not be started because the File Sharing Extension could not be found" }
  95.         SEATalkOffErr                = 10;        { "Appletalk is turned off." }
  96.         SEAppleTalkErr                = 11;        { "AppleTalk could not be activated." }
  97.         SENoInitRunErr                = 12;        { "AppleShare Setup file is not installed in the Server Folder." }
  98.         SESysTooOldErr                = 13;        { "The System File is too old for AppleShare (v3.0)." }
  99.         SEInsuffAppMemErr            = 14;        { "There was not enough memory for FileShare to startup." }
  100.         SEBadConfigErr                = 15;        { "AppleShare encountered a problem with the current configuration." }
  101.         SENoDTOnStartupErr            = 16;        { "The Desktop database on volume the startup volume could not be opened." }
  102.         SEDupNameErr                = 17;        { "Duplicate name error when registering.  Please choose another name." }
  103.  
  104.  
  105.     TYPE
  106.         { The SetupInfoRec used by the SCGetSetupInfo and SCSetSetupInfo calls. }
  107.         tLoginMsg = STRING[199];
  108.         SetupInfoRecPtr = ^SetupInfoRec;
  109.         SetupInfoRec = RECORD
  110.                 SIVersion: Integer;            { SetupInfoRec version: 1 for File Sharing and AppleShare 3.0 }
  111.                 SIFlags: Integer;            { 0 for File Sharing and AppleShare 3.0 }
  112.                 SIMaxLogins: Integer;        { 1..11 for File Sharing; 1..121 for AppleShare 3.0 }
  113.                 SISrvrUsageLimit: Integer;    { 10 to 100 (percent) }
  114.                 { All remaining fields in record are only used by the AppleShare file server }
  115.                 SIVolInfoLocation: Point;    { location of Volume Info window (default is -1,-1) }
  116.                 SIVolInfoVisible: Boolean;    { is Volume Info window visible (default is TRUE) }
  117.                 SIUserInfoLocation: Point;    { location of Connected Users window (default is -1,-1) }
  118.                 SIUserInfoVisible: Boolean;    { is Connected Users window visible (default is TRUE) }
  119.                 SIShutDownMins: Integer;    { default minutes until shutdown }
  120.                 SISpare: ARRAY[1..17] OF Integer;    { reserved }
  121.                 SILoginMsg: tLoginMsg;        { the current Login message }
  122.             END;
  123.  
  124.         startParam = RECORD
  125.                 reserved: LongInt;
  126.                 reserved2: Integer;
  127.                 reserved3: Integer;
  128.                 scCode: Integer;
  129.                 scStartSelect: Integer;
  130.                 scEventSelect: Integer;
  131.                 reserved4: ARRAY[1..4] OF LongInt;
  132.             END;
  133.  
  134.         disconnectParam = RECORD
  135.                 scDiscArrayPtr: LongIntPtr;
  136.                 scArrayCount: Integer;
  137.                 reserved: Integer;
  138.                 scCode: Integer;
  139.                 scNumMinutes: Integer;
  140.                 scFlags: Integer;
  141.                 scMessagePtr: StringPtr;
  142.             END;
  143.  
  144.         pollServerParam = RECORD
  145.                 reserved: LongInt;
  146.                 reserved2: Integer;
  147.                 reserved3: Integer;
  148.                 scCode: Integer;
  149.                 scServerState: Integer;
  150.                 scDisconnectState: Integer;
  151.                 scServerError: Integer;
  152.                 scSecondsLeft: LongInt;
  153.             END;
  154.  
  155.         standardParam = RECORD
  156.                 scNamePtr: StringPtr;
  157.                 scVRefNum: Integer;
  158.                 scLogins: Integer;
  159.                 scCode: Integer;
  160.                 scIndex: Integer;
  161.                 scDirID: LongInt;
  162.             END;
  163.  
  164.         setupParam = RECORD
  165.                 scSetupPtr: SetupInfoRecPtr;
  166.                 scMaxVolumes: Integer;
  167.                 scMaxExpFolders: Integer;
  168.                 scCode: Integer;
  169.                 scCurMaxSessions: Integer;
  170.             END;
  171.  
  172.         statusParam = RECORD
  173.                 scNamePtr: StringPtr;
  174.                 reserved2: Integer;
  175.                 reserved3: Integer;
  176.                 scCode: Integer;
  177.                 scServerFlags: Integer;
  178.                 scNumSessions: Integer;
  179.                 scUserListModDate: LongInt;
  180.                 scActivity: Integer;
  181.                 scVolListModDate: LongInt;
  182.             END;
  183.  
  184.         serverEventParam = RECORD
  185.                 scSEQEntryPtr: Ptr;
  186.                 reserved2: Integer;
  187.                 reserved3: Integer;
  188.                 scCode: Integer;
  189.             END;
  190.  
  191.         versionParam = RECORD
  192.                 scExtNamePtr: StringPtr;
  193.                 reserved2: Integer;
  194.                 reserved3: Integer;
  195.                 scCode: Integer;
  196.                 scServerType: Integer;
  197.                 scServerVersion: Integer;
  198.             END;
  199.  
  200.         userInfoParam = RECORD
  201.                 scNamePtr: StringPtr;
  202.                 reserved2: Integer;
  203.                 reserved3: Integer;
  204.                 scCode: Integer;
  205.                 scPosition: LongInt;
  206.                 scUNRecID: LongInt;
  207.                 scUserID: LongInt;
  208.                 scLoginTime: LongInt;
  209.                 scLastUseTime: LongInt;
  210.                 scSocketNum: AddrBlock;
  211.             END;
  212.  
  213.         volMountedParam = RECORD
  214.                 reserved: Ptr;
  215.                 scVRefNum: Integer;
  216.                 reserved3: Integer;
  217.                 scCode: Integer;
  218.                 scFilesOpen: Integer;
  219.                 scWriteableFiles: Integer;
  220.                 scUNRecID: LongInt;
  221.                 scMounted: Boolean;
  222.                 scMountedAsOwner: Boolean;
  223.             END;
  224.  
  225.         SCParamBlockPtr = ^SCParamBlockRec;
  226.         SCParamBlockRec = RECORD
  227.                 qLink: QElemPtr;
  228.                 qType: INTEGER;
  229.                 ioTrap: INTEGER;
  230.                 ioCmdAddr: Ptr;
  231.                 ioCompletion: ProcPtr;
  232.                 ioResult: OSErr;
  233.                 CASE Integer OF
  234.                     1: (
  235.                             startPB: startParam
  236.                     );
  237.                     2: (
  238.                             disconnectPB: disconnectParam
  239.                     );
  240.                     3: (
  241.                             pollServerPB: pollServerParam
  242.                     );
  243.                     4: (
  244.                             standardPB: standardParam
  245.                     );
  246.                     5: (
  247.                             setupPB: setupParam
  248.                     );
  249.                     6: (
  250.                             statusPB: statusParam
  251.                     );
  252.                     7: (
  253.                             serverEventPB: serverEventParam
  254.                     );
  255.                     8: (
  256.                             versionPB: versionParam
  257.                     );
  258.                     9: (
  259.                             userInfoPB: userInfoParam
  260.                     );
  261.                     10: (
  262.                             volMountedPB: volMountedParam
  263.                     );
  264.             END;
  265.  
  266.  
  267.     { ServerDispatch can be called synchronously only.  Asynchronous server control }
  268.     { calls are not supported. }
  269.     { Inputs:     A0 points to the SCParamBlockRec. }
  270.     {            D0 must be zero. }
  271.     {            SCParamBlockRec.scCode indicates the server control call. }
  272.     { Outputs:    D0.w and SCParamBlockRec.ioResult contain the result code. }
  273.     { Note:        Macintosh File Sharing does not return the result in D0.w }
  274.     {            so the glue code below moves it there for you. }
  275.  
  276.     { The glue to call the ServerDispatch trap }
  277.     FUNCTION SyncServerDispatch (PBPtr: SCParamBlockPtr): OSErr;
  278.     INLINE
  279.         $205F,          { MOVEA.L    (A7)+,A0       }
  280.         $7000,          { MOVEQ      #$00,D0        }
  281.         $A094,          { _ServerDispatch           }
  282.         $3028, $0010,    { MOVE.W    ioResult(A0),D0    }
  283.         $3E80;          { MOVE.W     D0,(A7)        }
  284.  
  285.  
  286. IMPLEMENTATION
  287.  
  288. END.
  289.